# -*-coding:utf-8-*-
import sys
import datetime
from props import properties

properties.props_init()
props = properties.props
from props.sql_connect import Base, db_engine
from crawler_func import update_api
import work_by_queue

# 创建表
Base.metadata.create_all(db_engine)

if __name__ == '__main__':
    args = sys.argv
    order = args[1]
    # order = 'api'
    work_by_queue.run(order)

    # crawler = update_api.update_api_crawler()
    # crawler.work('3259440',None)


def print_to_log():
    # make a copy of original stdout route
    stdout_backup = sys.stdout
    # define the log file that receives your log info
    log_file = open("message.log", "w")
    # redirect print output to log file
    sys.stdout = log_file
    print '-----------------', datetime.datetime.now(), '-----------------'
